package netWork.练习1_聊天室.多线程实现;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Package netWork.练习1_聊天室.多线程实现
 * @Author shimmer
 * @Date 2020/8/2 14:12
 * @TODO
 */
public class Server {
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(8888);
            Socket server = serverSocket.accept();
            SendThread sendThread = new SendThread(server);
            ReceiveThread receiveThread = new ReceiveThread(server);
            new Thread(sendThread).start();//开启发送线程
            new Thread(receiveThread).start();//开启接收线程
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
